﻿using static System.Console;

// Action:不返回值的方法，最多16个参数
Action<string> printMsg = s => WriteLine(s);
printMsg("hello action");


// Func:有返回值的方法,最多16个参数
Func<int, int, int> add = (x, y) => x + y;
WriteLine(add(3, 4));

Func<int, int, int, int> s = Sum;
WriteLine(s(1, 2, 3));

// Predicate:代表返回bool值的方法,通常用于条件判断
Predicate<int> IsEven = x => x % 2 == 0;
WriteLine(IsEven(10));

ReadLine();

static int Sum(int a, int b, int c)
{
    return a + b + c;
}